package com.junxi.microservices.bookstore.product.controller;

import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    private final DiscoveryClient discoveryClient;

    public TestController(DiscoveryClient discoveryClient) {
        this.discoveryClient = discoveryClient;
    }

    @GetMapping("/test/inventory-instances")
    public Object getInventoryInstances() {
        // 获取 inventory-service 的所有实例
        return discoveryClient.getInstances("inventory-service");
    }
}